/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.model.service;

import com.model.domain.persona.EstadoCivil;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Rdelacruz
 */
public class EstadoCivilService 
extends AbstractService
{   
        
    public List<EstadoCivil> findAll(Connection con) throws Exception {
        List<EstadoCivil> lista = new ArrayList<EstadoCivil>();
        
        
        Statement st = null;
        try {            
            
            st = con.createStatement();
            ResultSet rs = st.executeQuery("select * from EstadoCivil");
                       
            while(rs.next()) {                
                EstadoCivil ec = new EstadoCivil();
                ec.setCodigo(rs.getString("CodEstado"));
                ec.setNombre(rs.getString("NomEstado"));
                
                lista.add(ec);
            }
        }
        finally {
            if(st!=null) st.close();                        
        }
        return lista;
    }
    
    
    
}
